﻿#pragma once
#include "ADFGlobal.h"

/**
 * @desc 全局数据基类,用于向平台注册全局对象
 */
class ADF_EXPORT AsGlobalData : public QObject {
public:
	AsGlobalData();
	virtual ~AsGlobalData();

};

/**
 * @desc 用于快速构建全局对象的类模板，每个类只会构造一个全局对象
 */
template <typename _Type>
class AsGlobalInstance {
private:
	static _Type ms_instance;

public:
	static _Type& getInstance() {
		return ms_instance;
	}

	static _Type* getInstancePtr() {
		return &ms_instance;
	}
};

template <typename _Type>
_Type AsGlobalInstance<_Type>::ms_instance;

